package com.apes.fico.engine.service;

import com.apes.fico.engine.model.ElementGroup;
import com.apes.fico.engine.repository.ElementGroupRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName ElementGroupService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/1/29 10:13
 * @Version 1.0
 **/
@Service("elementGroupService")
public class ElementGroupService extends DomainService {
    @Autowired
    private ElementGroupRepository elementGroupRepository;

    /**
     * 保存
     *
     * @param request
     * @return
     */
    public ElementGroup create(SimpleRequest request) {
        ElementGroup elementGroup = request.getO(ElementGroup.class);
        return elementGroupRepository.save(elementGroup);
    }

    /**
     * 更新
     *
     * @param request
     * @return
     */
    public ElementGroup update(SimpleRequest request) {
        ElementGroup elementGroup = request.getO(ElementGroup.class);
        return elementGroupRepository.saveAndFlush(elementGroup);
    }
}
